package si;

import com.sun.corba.se.impl.util.Version;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;

public class SI {

    public static void main(String[] args) throws Exception {
        ArrayList<Car> carList = new ArrayList<Car>();

        Connection con = null;
        Statement st = null;
        ResultSet rs = null;

        String url = "jdbc:mysql://localhost/si_db";
        String user = "root";
        String password = "";

        Class.forName("com.mysql.jdbc.Driver");
        con = DriverManager.getConnection(url, user, password);

        st = con.createStatement();
        rs = st.executeQuery("SELECT * from `table 1`");

        while (rs.next()) {
            carList.add(new Car(rs.getInt("id"), rs.getInt("Price"), rs.getInt("Year"), rs.getInt("MPG min"), rs.getInt("MPG max"), rs.getInt("Mileage"), rs.getInt("Owner"), rs.getInt("Doors"), rs.getInt("Seats"), rs.getString("Brand"), rs.getString("Model"), rs.getString("Fuel"), rs.getString("Colour"), rs.getString("Style"), rs.getString("Gear box"), rs.getBoolean("Service History"), rs.getBoolean("Central locking"), rs.getBoolean("Airbags"), rs.getBoolean("AC")));
        }
        
        
    }
}
